/*
 * @Author: wangru
 * @Date: 2023-05-29 09:34:55
 * @LastEditors: renmingming
 * @LastEditTime: 2023-09-18 19:45:30
 */
import { defineStore } from 'pinia';

export const proModelStore = defineStore('proModelStore', {
	state: () => {
		return {
      downloadInfo: {},// 报表下载信息
      onInfoModal:false,//是否打开信息弹窗
      openEditModalStatus: false, //是否打开编辑弹窗
      isUnitComplete:true,  //是否是完整的单位
			isRefresh: false, //刷新最近使用项目列表
			isClickOpen: false, //侧边栏点击打开线上项目
      isUpdateProjectStructure: false, // 是否有更新编辑项目结构
		};
	},
	actions: {
    setUpdateProjectStructure(status) {
      console.log('更新状态', status)
      this.isUpdateProjectStructure = status
    },
    onEditModal(status = true){
      this.openEditModalStatus = status
    },
    init(){
      this.onInfoModal = false//是否打开信息弹窗
      this.openEditModalStatus = false //是否打开编辑弹窗
      this.isUnitComplete =  true  //是否是完整的单位
    },
    // 设置是否是完整的单位，用于点击分部分享是否弹窗等
    setUnitStatus(status) {
      this.isUnitComplete = status
    },
		SET_Refresh(info) {
			this.isRefresh = info;
		},
		SET_IS_Click_Open(info) {
			this.isClickOpen = info;
		},
	},
  persist: {
    enabled: true, // true 表示开启持久化保存,
    strategies: [
      {
        key: 'proModelStore',
        storage: localStorage,
      },
    ],
  }
});
